<template>
  <div id="app">
    <!-- 固定顶部导航栏 -->
    <header class="app-header">
      <h1>漫画创作助手</h1>
    </header>

    <!-- 可滚动的主要内容区域 -->
    <main class="app-content">
      <TextToComic v-if="currentTab === 'text'"
                   @request-style="currentTab = 'style'"
                   @request-six-panel="currentTab = 'six-panel'"/>
      <ImageToComic v-if="currentTab === 'image'"/>

      <!--     <StyleCustomizer v-if="currentTab === 'style'"
                          @style-selected="handleStyleSelected"/>

         <StoryGenerator v-if="currentTab === 'story'"
                         @story-generated="handleStoryGenerated"/>

         <SixPanelComic v-if="currentTab === 'six-panel'"
                        @back-to-text="currentTab = 'text'"/>-->
    </main>

    <!-- 固定底部标签栏 -->
    <nav class="bottom-tabs">
      <button v-for="tab in tabs"
              :key="tab.id"
              @click="currentTab = tab.id"
              :class="{ 'active': currentTab === tab.id }">
        <i :class="tab.icon"></i>
        <span class="tab-label">{{ tab.label }}</span>
      </button>
    </nav>
  </div>
</template>

<script>
import TextToComic from './components/TextToComic.vue'
import ImageToComic from './components/ImageToComic.vue'
import StyleCustomizer from './components/StyleCustomizer.vue'
import StoryGenerator from './components/StoryGenerator.vue'
import SixPanelComic from './components/SixPanelComic.vue'

export default {
  name: 'App',
  components: {
    TextToComic,
    ImageToComic,
    StyleCustomizer,
    StoryGenerator,
    SixPanelComic
  },
  data() {
    return {
      currentTab: 'text',
      tabs: [
        {id: 'text', label: '文本转漫画', icon: 'fas fa-align-left'},
        {id: 'image', label: '图像转漫画', icon: 'fas fa-image'},
        /*        {id: 'style', label: '风格定制', icon: 'fas fa-palette'},
                {id: 'story', label: '故事生成', icon: 'fas fa-book'}*/
      ],
      selectedStyle: null
    }
  },
  methods: {
    handleStyleSelected(style) {
      this.selectedStyle = style;
      this.currentTab = 'text';
      this.$emit('style-updated', style);
    },
    handleStoryGenerated(story) {
      this.currentTab = 'text';
      this.$emit('story-generated', story);
    }
  }
}
</script>

<style>
/* 基础重置 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* 全局样式 */
body {
  font-family: 'Arial', sans-serif;
  line-height: 1.6;
  color: #333;
  background-color: #f5f5f5;
  padding: 0;
  margin: 0;
  padding-bottom: 70px;
}

/* 应用容器 */
#app {
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
}

/* 顶部导航栏 - 固定定位 */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background-color: #4CAF50;
  color: white;
  padding: 20px 20px;
  text-align: center;
  z-index: 1000;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app-header h1 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 500;
}

/* 主要内容区域 - 修改部分 */
.app-content {
  position: fixed;
  height: calc(100vh - 50px);
  top: 0;
  left: 0;
  flex: 1;
  padding: 90px 0px 80px;
  margin: 0;
  width: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* 底部标签栏 - 固定定位 */
.bottom-tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: #4CAF50;
  display: flex;
  justify-content: space-around;
  padding: 12px 0;
  box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  height: 80px; /* 增加高度以容纳更大的字体 */
}

.bottom-tabs button {
  background: none;
  border: none;
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 12px;
  font-size: 1.3rem; /* 增大字体大小 */
  cursor: pointer;
  opacity: 0.7;
  transition: all 0.3s ease;
  flex: 1;
  outline: none;
}

.bottom-tabs button:hover {
  opacity: 0.9;
}

.bottom-tabs button.active {
  opacity: 1;
  transform: translateY(-5px);
}

.bottom-tabs button i {
  font-size: 2rem; /* 增大图标大小 */
  margin-bottom: 8px; /* 增加图标与文字间距 */
}

.tab-label {
  font-size: 1.1rem; /* 增大标签文字大小 */
  white-space: nowrap;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .app-header {
    height: 65px;
    padding: 15px 20px;
  }

  .app-header h1 {
    font-size: 1.6rem;
  }

  .app-content {
    padding: 85px 0 85px; /* 调整padding以适应更大的底部栏 */
  }

  .bottom-tabs {
    height: 75px;
    padding: 10px 0;
  }

  .bottom-tabs button {
    font-size: 1.2rem;
    padding: 6px 10px;
  }

  .bottom-tabs button i {
    font-size: 1.8rem;
  }

  .tab-label {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .app-header {
    height: 60px;
    padding: 12px 15px;
  }

  .app-header h1 {
    font-size: 1.4rem;
  }

  .app-content {
    padding: 80px 0 80px;
  }

  .bottom-tabs {
    height: 70px;
    padding: 8px 0;
  }

  .bottom-tabs button {
    font-size: 1.1rem;
    padding: 5px 8px;
  }

  .bottom-tabs button i {
    font-size: 1.6rem;
  }

  .tab-label {
    font-size: 0.9rem;
  }
}
</style>